/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */

package edu.gatech.teama.doctorsoffice.model;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * SystemAdmin.java:  Builds administrator of this system
 * @author Team A
 * @version 1.0
 *
 */
public class SystemAdmin extends User {
	
	/**
	 * Logger for all <code>SystemAdmin</code> instances.
	 */
	private static final Logger LOGGER =
		Logger.getLogger("edu.gatech.teama.doctorsoffice.model.SystemAdmin");

	static {
        FileHandler fh = null;
        try {
            fh = new FileHandler("application.log");
        } catch (SecurityException e) {
            LOGGER.log(Level.SEVERE, "Security Exception creating the logger " +
            		"file handler");
            e.printStackTrace();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "IO Exception creating the logger file handler");
            e.printStackTrace();
        }

        LOGGER.addHandler(fh);
        LOGGER.setLevel(Level.ALL);
    }

	/**
	 * Defines a SystemAdmin by name and username
	 * @param username
	 * @param firstName
	 * @param lastName
	 */
	public SystemAdmin(String username, String firstName, String lastName) {
		super(username, firstName, lastName);
	}
	
	/**
	 * System Admin constructor
	 * @param username
	 * @param firstName
	 * @param lastName
	 * @param phoneNumber
	 * @param address
	 * @param emailAddress
	 */
	public SystemAdmin(String username, String firstName, String lastName, String phoneNumber, Address address, String emailAddress){
			super(username, firstName, lastName, phoneNumber, address, emailAddress);

		LOGGER.log(Level.INFO, "New SystemAdmin: " + username + ", " + firstName
				+ " " + lastName + ", " + phoneNumber + ", "
				+ address + ", " + emailAddress);     
	}
	
	public String toString() { // $codepro.audit.disable methodJavadoc
		return "SystemAdmin: username = " + this.getUsername();
	}
}
